package com.ifast.hnzk.util;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;


//@Configuration
@Slf4j
public class MyWebAppConfigurer extends WebMvcConfigurerAdapter {
    @Value("${hnzk_upload_path}")
    private String upload_path;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        log.debug("======web资源加载映射配置=====");
        /**
         * 资源映射路径
         * addResourceHandler：访问映射路径
         * addResourceLocations：资源绝对路径
         */
        registry.addResourceHandler("/image/**").addResourceLocations("file:"+upload_path);
        //registry.addResourceHandler("/**").addResourceLocations("file:D:/git/Repositoryifast-wch-dev/upload/");
    }

}
